@import '../../../styles/theme.less';

.error-trend-chart {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: @radius-xl;
  transition: @transition-bounce;
  position: relative;
  overflow: hidden;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: @bg-gradient;
  }
  
  &:hover {
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.15);
  }
  
  .ant-card-head {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: @radius-xl @radius-xl 0 0;
    
    .ant-card-head-title {
      color: rgba(255, 255, 255, 0.9);
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: @spacing-sm;
      
      .title-icon {
        color: @primary-color;
        font-size: 18px;
      }
    }
    
    .ant-card-extra {
      .ant-btn {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: rgba(255, 255, 255, 0.8);
        border-radius: @radius-md;
        transition: @transition-bounce;
        
        &:hover {
          background: rgba(255, 255, 255, 0.1);
          border-color: rgba(102, 126, 234, 0.5);
          color: white;
          box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
        }
      }
    }
  }
  
  .ant-card-body {
    background: transparent;
    padding: @spacing-lg;
  }
  
  .chart-controls {
    margin-bottom: @spacing-lg;
    padding: @spacing-md;
    background: rgba(255, 255, 255, 0.03);
    border-radius: @radius-lg;
    border: 1px solid rgba(255, 255, 255, 0.08);
    
    .control-group {
      display: flex;
      align-items: center;
      gap: @spacing-sm;
      
      label {
        font-size: @text-sm;
        color: rgba(255, 255, 255, 0.6);
        white-space: nowrap;
        min-width: 80px;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }
      
      .ant-select,
      .ant-input-number,
      .ant-switch {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: @radius-md;
        
        &:hover {
          border-color: rgba(102, 126, 234, 0.5);
        }
        
        &:focus,
        &.ant-select-focused {
          border-color: @primary-color;
          box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
        }
      }
      
      .ant-select-selector {
        background: transparent !important;
        color: rgba(255, 255, 255, 0.8) !important;
        border: none !important;
      }
      
      .ant-select-selection-placeholder {
        color: rgba(255, 255, 255, 0.4) !important;
      }
      
      .ant-input-number {
        color: rgba(255, 255, 255, 0.8);
        
        .ant-input-number-input {
          background: transparent;
          color: rgba(255, 255, 255, 0.8);
        }
      }
      
      .ant-switch {
        background: rgba(255, 255, 255, 0.1);
        
        &.ant-switch-checked {
          background: @bg-gradient;
        }
      }
    }
  }
  
  .chart-container {
    position: relative;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: @radius-lg;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    
    .chart-loading {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 400px;
      color: rgba(255, 255, 255, 0.6);
      
      .ant-spin {
        .ant-spin-dot {
          i {
            background-color: @primary-color;
          }
        }
      }
      
      p {
        margin-top: @spacing-md;
        font-size: @text-sm;
        color: rgba(255, 255, 255, 0.5);
      }
    }
    
    .chart-content {
      border-radius: @radius-lg;
      overflow: hidden;
      
      // G2 图表样式覆盖
      .g2-tooltip {
        background: rgba(15, 52, 96, 0.95) !important;
        backdrop-filter: blur(25px);
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: @radius-md !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
        color: rgba(255, 255, 255, 0.9) !important;
      }
      
      .g2-tooltip-title {
        color: rgba(255, 255, 255, 0.9) !important;
        font-weight: 600 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding-bottom: @spacing-xs !important;
        margin-bottom: @spacing-xs !important;
      }
      
      .g2-tooltip-list-item {
        color: rgba(255, 255, 255, 0.7) !important;
        
        .g2-tooltip-marker {
          border-radius: 50% !important;
        }
        
        .g2-tooltip-value {
          font-weight: 600 !important;
          color: rgba(255, 255, 255, 0.9) !important;
        }
      }
    }
  }
  
  .chart-legend {
    margin-top: @spacing-md;
    padding: @spacing-md;
    background: rgba(255, 255, 255, 0.03);
    border-radius: @radius-lg;
    border: 1px solid rgba(255, 255, 255, 0.08);
    
    .legend-title {
      color: rgba(255, 255, 255, 0.8);
      font-weight: 600;
      margin-bottom: @spacing-sm;
      font-size: @text-sm;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    
    .legend-items {
      display: flex;
      flex-wrap: wrap;
      gap: @spacing-md;
      
      .legend-item {
        display: flex;
        align-items: center;
        gap: @spacing-xs;
        
        .legend-color {
          width: 12px;
          height: 12px;
          border-radius: 50%;
          border: 1px solid rgba(255, 255, 255, 0.2);
        }
        
        .legend-label {
          color: rgba(255, 255, 255, 0.7);
          font-size: @text-xs;
        }
      }
    }
  }
  
  .realtime-indicator {
    position: absolute;
    top: @spacing-md;
    right: @spacing-md;
    display: flex;
    align-items: center;
    gap: @spacing-xs;
    padding: @spacing-xs @spacing-sm;
    background: rgba(0, 0, 0, 0.6);
    border-radius: @radius-md;
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    .indicator-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: @success-color;
      animation: pulse 2s infinite;
    }
    
    .indicator-text {
      color: rgba(255, 255, 255, 0.8);
      font-size: @text-xs;
      font-weight: 500;
    }
  }
  
  .fullscreen-btn {
    position: absolute;
    top: @spacing-md;
    right: @spacing-xl;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    border-radius: @radius-md !important;
    
    &:hover {
      background: rgba(255, 255, 255, 0.1) !important;
      border-color: rgba(102, 126, 234, 0.5) !important;
      color: white !important;
    }
  }
}

// 全屏模式样式
.chart-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(25px);
  
  .error-trend-chart {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    
    .chart-container {
      height: calc(100vh - 200px);
    }
  }
}

// 动画定义
@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

// 响应式设计
@media (max-width: 768px) {
  .error-trend-chart {
    .chart-controls {
      .control-group {
        flex-direction: column;
        align-items: flex-start;
        gap: @spacing-xs;
        
        label {
          min-width: auto;
        }
      }
    }
    
    .chart-legend {
      .legend-items {
        flex-direction: column;
        gap: @spacing-sm;
      }
    }
  }
}